package engine

import (
	"log"
)

type SimpleEngine struct{}

func (e SimpleEngine) Run(seeds ...Request) {
	var Requests []Request
	for _, r := range seeds {
		Requests = append(Requests, r)
	}

	for len(Requests) > 0 {
		r := Requests[0]
		Requests = Requests[1:]
		log.Printf("Fetching %s\n", r.Url)
		ParseResult, err := worker(r)
		if err != nil {
			continue
		}
		Requests = append(Requests, ParseResult.Requests...)
		for _, item := range ParseResult.Items {
			log.Printf("Got item : %v\n", item)
		}
	}
}
